Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OV-28: add remotion player #45

Merged
merged 2 commits into from
Aug 23, 2024
Merged

Conversation

WilsonBravo
Copy link
Contributor

FEAT: Add Remotion player #28

Test Video Component

  const MyVideoComponent: React.FC = () => {
      const frame = useCurrentFrame();
      const opacity = interpolate(frame, [0, 30], [0, 1]);
  
      return (
          <AbsoluteFill style={{ backgroundColor: 'black' }}>
              <Video
                  src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4"
                  style={{
                      width: '100%',
                      height: '100%',
                      objectFit: 'cover',
                      opacity,
                  }}
              />
          </AbsoluteFill>
      );
  };

Test Video Control Panel Component

  const VideoControlPanel = (): JSX.Element => {
      const playerReference = useRef<PlayerRef>(null);
  
      const [orientation, setOrientation] = useState<'portrait' | 'landscape'>(
          'landscape',
      );
      const [isPlaying, setIsPlaying] = useState(false);
  
      const onChangeOrientation = useCallback(() => {
          setOrientation(orientation === 'landscape' ? 'portrait' : 'landscape');
      }, [orientation]);
  
      const handlePlayPause = useCallback(() => {
          if (isPlaying && playerReference.current) {
              playerReference.current.pause();
              setIsPlaying(false);
          } else if (!isPlaying && playerReference.current) {
              playerReference.current.play();
              setIsPlaying(true);
          }
      }, [isPlaying]);
  
      return (
          <>
              <button onClick={handlePlayPause} type="button">
                  Play/Pause
              </button>
              <button onClick={onChangeOrientation} type="button">
                  Change Orientation
              </button>
              <Player
                  VideoComponent={MyVideoComponent}
                  playerRef={playerReference}
                  orientation={orientation}
                  durationInFrames={3000}
              />
          </>
      );
  };

player_component_v3

@WilsonBravo WilsonBravo added the FE Fronted feature label Aug 21, 2024
@WilsonBravo WilsonBravo added this to the Release 1.0 milestone Aug 21, 2024
@WilsonBravo WilsonBravo self-assigned this Aug 21, 2024
@WilsonBravo WilsonBravo linked an issue Aug 21, 2024 that may be closed by this pull request
8 tasks
@nikita-remeslov nikita-remeslov merged commit e05cf25 into next Aug 23, 2024
2 of 3 checks passed
@nikita-remeslov nikita-remeslov deleted the task/OV-28-add-remotion-player branch August 23, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FE Fronted feature
Projects
Status: To Be Tested
Development

Successfully merging this pull request may close these issues.

FEAT: Add Remotion player
3 participants